package com.geek.factory.service.impl;





import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geek.factory.dto.DeviceRepairReportDTO;
import com.geek.factory.entity.DeviceRepairReport;
import com.geek.factory.mapper.DeviceRepairReportMapper;
import com.geek.factory.service.DeviceRepairReportService;

import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceRepairReportServiceImpl  extends ServiceImpl<DeviceRepairReportMapper, DeviceRepairReport> implements DeviceRepairReportService {

    @Override
    public List<DeviceRepairReportDTO> getAllReportsWithLineName() {
        return baseMapper.selectAllReportsWithLineName();
    }

    @Override
    public DeviceRepairReportDTO getReportByIdWithLineName(Long id) {
        return baseMapper.selectReportWithLineName(id);
    }

    @Override
    public IPage<DeviceRepairReportDTO> getPagedReports(int page, int size) {
        Page<DeviceRepairReportDTO> pageParam = new Page<>(page, size);
        return baseMapper.selectPagedReportsWithLineName(pageParam);
    }

    @Override
    public boolean updateStatus(Long reportId, String status) {
        return baseMapper.updateStatus(reportId, status) > 0;
    }



}
